# 通讯录页面
from faker import Faker
from selenium.webdriver.common.by import By

from test_pytest.Utils.log_util import logger
from wxin_po.package.basedriver import BaseDriver
from wxin_po.package.contact_page import ContactPage


class EditMember(BaseDriver):

    # 输入姓名
    def input_name(self, name):
        logger.info("请输入姓名:")
        # 获取定位并输入内容
        self.find_content(By.ID, "username", name)
        return self

    def input_phone(self, phone):
        logger.info("请输入手机号")
        # 获取定位并输入内容
        self.find_content(By.ID, "memberAdd_phone", phone)

        return self

    def input_mark(self, mark):
        logger.info("请输入标识")
        # 获取定位并输入内容
        self.find_content(By.ID, "memberAdd_acctid", mark)
        return self

    def click_save(self):
        # 获取定位并点击保存
        self.find_and_click(By.XPATH, "//*[text()='保存']")
        # 跳转到通讯录界面
        return ContactPage(self._driver)
